<template>
	<view>
		<!-- 完善信息提示弹窗 -->
		<uni-popup ref="popup" :type="type" :mask-click="mask" @maskClick="maskClick">
			<view class="popupTipsBox">
				<view class="homePopupBox flex-row">
					<image class="homePopupImg" src="http://www.bobei.shop/static/third/homePopupImg.png"></image>
					<view class="homePopupTips">
						现在可以完善资料了呦～
					</view>
					<button class="completeBtn" :plain="true" @click="onPrefect">
						<view class="lineBox flex">
							<view class="line"></view>
							<view class="line2"></view>
						</view>
						去完善
					</button>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		emits: ["tipsOpen", "tipsClose"],
		props: {
			showTips: {
				type: Boolean,
				default: false
			},
			type: {
				type: String,
				default: "center"
			},
			mask: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {

			}
		},
		watch: {
			showTips(val) {
				if (val) {
					this.open()
				} else {
					this.close();
				}
			}
		},
		methods: {
			maskClick() {
				if (this.mask) {
					this.$refs.popup.close();
					this.$emit("tipsClose", false);
				}

			},
			open() {
				this.$refs.popup.open();
				this.$emit("tipsOpen", true);
			},
			close() {
				this.$refs.popup.close();
				this.$emit("tipsClose", false);
			},
			onPrefect() {
				this.$emit("onPrefect");
			},
		},
	}
</script>

<style scoped lang="scss">
	.popupTipsBox {
		width: 100%;
		background-color: #FFFFFF;
		border-radius: 16rpx;
		position: relative;

		.homePopupBox {
			width: 522rpx;
			height: 458rpx;
			background: #FFFFFF;
			border-radius: 40rpx 40rpx 40rpx 40rpx;
			flex-direction: column;
			padding-top: 36rpx;

			.homePopupImg {
				width: 382rpx;
				height: 262rpx;
			}

			.homePopupTips {
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
				text-align: center;
				margin-top: 4rpx;
			}

			.completeBtn {
				width: 222rpx;
				height: 58rpx;
				background: #F2615F;
				border-radius: 50rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 33rpx;
				padding: 0;
				margin: 20rpx 0 0;
				border: none;
				position: relative;

				.lineBox {
					position: absolute;
					top: 8rpx;
					left: 24rpx;

					.line {
						width: 10rpx;
						height: 2rpx;
						background: #FFFFFF;
						border-radius: 2rpx;
					}

					.line2 {
						width: 32rpx;
						height: 2rpx;
						background: #FFFFFF;
						border-radius: 2rpx;
						margin-left: 6rpx;
					}
				}
			}
		}
	}
</style>
